﻿var StaticPub = "1"; //静态发布
var DynamicPub = "2"; //动态发布
var NotOutPub = "3"; //不对外发布
var SelectPub = "";
//原来的响应各个tab的相关js代码 begin
var tooldata = [{ id: "baseinfo", txt: "基本参数" },
                { id: "content", txt: "结点内容" },
                { id: "seoandother", txt: "SEO及其它设置" }
               ];
function showtool(name) {
    $.each(tooldata, function (i, n) {
        if (n.id == name) {
            $("#" + name).show();
            $("#" + name + "_tab").css('background', '#2A7AD2 !important');
        }
        else {
            $("#" + n.id).hide();
            $("#" + n.id + "_tab").css('background', '#999 !important');
        }
    });
}
//原来的响应各个tab的相关js代码 end
//打开模板选择对话
function tplSelect(path, form, id) {
    var parm = '?roottype=templete&extname=.html|.htm&setid=' + id + '&selpath=' + path + '&t=' + Math.random();
    show_dialog('../AdminSelect.aspx' + parm, 450, 240, '选择模板');
}
//打开模板选择对话
function tplSelectRootImg(path, form, id) {
    var parm = '?roottype=root&extname=.gif|.png|.jpg|.jpeg&setid=' + id + '&selpath=' + path;
    show_dialog('../AdminSelect.aspx' + parm, 450, 230, '选择文件');
}

//事件邦定
function bind() {
    //绑定各个发布模式的响应函数
    $("[name='rbtnContentPubTypeId']").each(function () {
        var obj = $(this);
        //obj.attr("onclick", "ContentPubTypeView(this.value);");
        obj.click(function () { ContentPubTypeView(obj.val()); });
    });
    //内容发布目录规则
    $("#ddlHtmlRootReg").change(function () {
        $('#txtHtmlRootReg').val($(this).val());
    });
    //资源发布目录规则
    $("#ddlSourceRootReg").change(function () {
        $('#txtSourceRootReg').val($(this).val());
    });
}


//选择发布模式的响应函数
function ContentPubTypeView(val) {
    SelectPub = val;
    if (val == StaticPub) {//静态
        $("#node_staticpublish").show();
        $("#node_dynamicpublic").hide();
        $("#node_source").show();
        $("#node_publish").show();
        $("#node_auopub").show();
    }
    else if (val == DynamicPub) {//动态
        $("#node_staticpublish").hide();
        $("#node_dynamicpublic").show();
        $("#node_publish").show();
        $("#node_source").show();
        $("#node_auopub").show();
    }
    else if (val == NotOutPub) {//不对外发布
        $("#node_staticpublish").hide();
        $("#node_dynamicpublic").hide();
        $("#node_publish").hide();
        $("#node_source").show();
        $("#node_auopub").hide();
    }
}

function SelfCheck() {
    var _check_result = true;
    if (SelectPub == StaticPub) {

        if ($('#txtSourcePSN').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtSourcePSN'));
            _check_result = false;
        }
        else if ($('#txtSourceUrl').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtSourceUrl'));
            _check_result = false;
        }
        else if ($('#txtIndexTemplate').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtIndexTemplate'));
            _check_result = false;
        }
        else if ($('#txtDetailTemplate').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtDetailTemplate'));
            _check_result = false;
        }
        else if ($('#txtHtmlPSN').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtHtmlPSN'));
            _check_result = false;
        }
        else if ($('#txtHtmlUrl').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtHtmlUrl'));
            _check_result = false;
        }
        else if ($('#txtIndexName').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtIndexName'));
            _check_result = false;
        }
        else if ($('#txtHtmlNameReg').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtHtmlNameReg'));
            _check_result = false;
        }

    } else if (SelectPub == DynamicPub) {
        if ($('#txtSourcePSN').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtSourcePSN'));
            _check_result = false;
        }
        else if ($('#txtSourceUrl').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtSourceUrl'));
            _check_result = false;
        }
        else if ($('#txtIndexTemplate').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtIndexTemplate'));
            _check_result = false;
        }
        else if ($('#txtDetailTemplate').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtDetailTemplate'));
            _check_result = false;
        }
        else if ($('#txtIndexPortalURL').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtIndexPortalURL'));
            _check_result = false;
        }
        else if ($('#txtContentPortalURL').val() == '') {
            _F_FR_Check_RquiredAlert($_ID('txtContentPortalURL'));
            _check_result = false;
        }
    }
    return _check_result;
}

